"""
@author: z
@file: 2022-10-28-.py
@time: 2022/10/31 20:16
"""

import random
import time

def test():
    a = ""
    for i in range(12):
        b = str(random.randint(0,1))
        a += b # a = a + b
    b = random.randint(0, 11)
    print(a,b)
    if a[b:b+1] == "1":
        print("light")
    else:
        print("down")

# test()


def idcard(): # 方法 不调用就没用
    id = input("请输入您的身份证：")
    if id == "q" or id == "quit":
        return -1
    if len(id) == 18 and id.isdigit():
        bown_year = id[6:10]
        now_year = time.strftime("%Y") #year mouth day M minute S second
        age = int(now_year) - int(bown_year)
        if age <= 18:
            print("未成年")
        elif 18 < age <= 50:
            print("青壮年")
        elif 50 < age:
            print("老年人")
    else:
        print("格式有误，请重新输入")
        idcard()
idcard()



